package c.e.b.h.e.s;

import android.content.Context;
import c.e.b.h.e.b;
import java.io.File;

/* compiled from: CachedSettingsIo */
public class a {
    public final Context a;

    public a(Context context) {
        this.a = context;
    }

    public final File a() {
        File file = new File(this.a.getFilesDir(), ".com.google.firebase.crashlytics");
        b bVar = b.a;
        if (!(file.exists() || file.mkdirs())) {
            bVar.f("Couldn't create file");
            file = null;
        }
        return new File(file, "com.crashlytics.settings.json");
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x003e A:{Catch:{ all -> 0x0047 }} */
    public org.json.JSONObject b() {
        /*
        r7 = this;
        r0 = c.e.b.h.e.b.a;
        r1 = "Error while closing settings cache file.";
        r2 = "Reading cached settings...";
        r0.b(r2);
        r2 = 0;
        r3 = r7.a();	 Catch:{ Exception -> 0x0033, all -> 0x0031 }
        r4 = r3.exists();	 Catch:{ Exception -> 0x0033, all -> 0x0031 }
        if (r4 == 0) goto L_0x0026;
    L_0x0014:
        r4 = new java.io.FileInputStream;	 Catch:{ Exception -> 0x0033, all -> 0x0031 }
        r4.<init>(r3);	 Catch:{ Exception -> 0x0033, all -> 0x0031 }
        r3 = c.e.b.h.e.k.g.u(r4);	 Catch:{ Exception -> 0x0024 }
        r5 = new org.json.JSONObject;	 Catch:{ Exception -> 0x0024 }
        r5.<init>(r3);	 Catch:{ Exception -> 0x0024 }
        r2 = r4;
        goto L_0x002c;
    L_0x0024:
        r3 = move-exception;
        goto L_0x0035;
    L_0x0026:
        r3 = "No cached settings found.";
        r0.b(r3);	 Catch:{ Exception -> 0x0033, all -> 0x0031 }
        r5 = r2;
    L_0x002c:
        c.e.b.h.e.k.g.c(r2, r1);
        r2 = r5;
        goto L_0x0046;
    L_0x0031:
        r0 = move-exception;
        goto L_0x0049;
    L_0x0033:
        r3 = move-exception;
        r4 = r2;
    L_0x0035:
        r5 = "Failed to fetch cached settings";
        r6 = 6;
        r0 = r0.a(r6);	 Catch:{ all -> 0x0047 }
        if (r0 == 0) goto L_0x0043;
    L_0x003e:
        r0 = "FirebaseCrashlytics";
        android.util.Log.e(r0, r5, r3);	 Catch:{ all -> 0x0047 }
    L_0x0043:
        c.e.b.h.e.k.g.c(r4, r1);
    L_0x0046:
        return r2;
    L_0x0047:
        r0 = move-exception;
        r2 = r4;
    L_0x0049:
        c.e.b.h.e.k.g.c(r2, r1);
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.b.h.e.s.a.b():org.json.JSONObject");
    }
}
